**************************************************
* Michael Ross Replication Project
* Analysis Code
*
* Paul Musgrave and Yu-Ming Liou
* rpm47@georgetown.edu and yl254@georgetown.edu
* 
* Created 27 February 2016
*
**************************************************


**************************************************
* Stata Housekeeping
**************************************************

clear all
capture log close
set more off

version 11.1

* Change to your valid directory
cd "/Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0127 Oil Islam Women/ISQ Accepted Submission/Replication/Data"
use "ISQ FINAL Data for Selected Appendix Analyses.dta"
cd "../Drafts/Tables"

tsset iso year


* * * * * * * * * * * * * * * * * * * * * * * * * 
*Clean up data
* * * * * * * * * * * * * * * * * * * * * * * * * 

lab var FDlogGDP_cap2000_sup_1 "Log GDP per cap"
lab var FDlogGDP_cap2000_supSQ_1 "Log-Square GDP per cap"
lab var FDage_1 "Working Age Pct of Population"
lab var FDoil_gas_valuePOPred_1 "Oil Income per cap"

drop pwt_25ile_60 pwt_50ile_60 pwt_75ile_60 ///
pwt_25ile_65 pwt_50ile_65 pwt_75ile_65 pwt_25ile_73 ///
pwt_50ile_73 pwt_75ile_73 pwtk_25ile_60 ///
pwtk_50ile_60 pwtk_75ile_60 pwtk60_25_temp ///
pwtk60_50_temp pwtk60_75_temp pwtk_25ile_65 ///
pwtk_50ile_65 pwtk_75ile_65 pwtk65_25_temp ///
pwtk65_50_temp pwtk65_75_temp pwtk_25ile_73 ///
pwtk_50ile_73 pwtk_75ile_73 pwtk73_50_temp ///
pwtk73_25_temp pwtk73_75_temp cheibub60 ///
cheibubindicator60 cheibub65 cheibubindicator65 ///
cheibub73 cheibubindicator73 polity60 ///
polityindicator polity65 polityindicator_alt65 ///
polity73 polityindicator_alt73

* * * * * * * * * * * * * * * * * * * * * * * * * 
* Straight Replications
* * * * * * * * * * * * * * * * * * * * * * * * * 

local rossmodel FDlogGDP_cap2000_sup_1 FDlogGDP_cap2000_supSQ_1 FDage_1

* p. 137, Table 4.5, column 1
xtregar FDlaborfemale `rossmodel', fe
eststo Rep45col1

* p. 137, Table 4.5, column 2
xtregar FDlaborfemale `rossmodel' FDoil_gas_valuePOPred_1, fe
eststo Rep45col2

* p. 137, Table 4.5, column 3
xtregar FDlaborfemale `rossmodel' FDoil_gas_valuePOPred_1
eststo Rep45col3

* p. 137, Table 4.5, column 4
* xtreg FDlaborfemale `rossmodel' FDoil_gas_valuePOPred_1 year1* year2*, fe
* eststo Rep45col4

* p. 137, Table 4.5, column 5
xtregar FDlaborfemale `rossmodel' FDoil_gas_valuePOPred_1 ///
if cty != "Saudi Arabia" & cty != "Kuwait", fe
eststo Rep45col5

* p. 137, Table 4.5, column 6
xtregar FDlaborfemale `rossmodel' FDoil_gas_valuePOPred_1 ///
if me_nafr==0, fe

eststo Rep45col6

* p. 137, Table 4.5, column 7
xtregar FDlaborfemale `rossmodel' FDoil_gas_valuePOPred_1 ///
if me_nafr==1, fe

eststo Rep45col7

*Column 8: using log of oil income
xtregar FDlaborfemale `rossmodel' FDlogoil_gas_valuePOP_1, fe

eststo Rep45col8


esttab Rep45col1 Rep45col2 Rep45col3 ///
Rep45col5 Rep45col6 Rep45col7 /// 
using ISQFINALAppendixTable04.tex, ///
 replace p label nomtitles ///
booktabs substitute({table} {sidewaystable}) ///
title("Replicating Ross" \label{tab:rossrepli}) ///
addnotes("Dependent Variable is Female Labor Force Participation.")

esttab Rep45col1 Rep45col2 Rep45col3 ///
Rep45col5 Rep45col6 Rep45col7 /// 
using ISQFINALAppendixTable04.txt, ///
 replace p label ///
title("Replicating Ross" \label{tab:rossrepli}) ///
addnotes("Dependent Variable is Female Labor Force Participation.")


* * * * * * * * * * * * * * * * * * * * * * * * * 
* Modified Replicaiton (No GDP Sq Log)
* * * * * * * * * * * * * * * * * * * * * * * * * 

local rossmodel2 FDlogGDP_cap2000_sup_1 FDage_1

* p. 137, Table 4.5, column 1
xtregar FDlaborfemale `rossmodel2', fe
eststo Rep45col12

* p. 137, Table 4.5, column 2
xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1, fe
eststo Rep45col22

* p. 137, Table 4.5, column 3
xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1
eststo Rep45col32

* p. 137, Table 4.5, column 4
* xtreg FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 year1* year2*, fe
* eststo Rep45col42

* p. 137, Table 4.5, column 5
xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if cty != "Saudi Arabia" & cty != "Kuwait", fe
eststo Rep45col52

* p. 137, Table 4.5, column 6
xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if me_nafr==0, fe
eststo Rep45col62

* p. 137, Table 4.5, column 7
xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if me_nafr==1, fe
eststo Rep45col72

*Column 8: using log of oil income
xtregar FDlaborfemale `rossmodel2' FDlogoil_gas_valuePOP_1, fe
eststo Rep45col82

esttab Rep45col12 Rep45col22 Rep45col32 ///
Rep45col52 Rep45col62 Rep45col72 /// 
using ISQFINALAppendixTable05.tex, ///
 replace p label ///
booktabs substitute({table} {sidewaystable}) nomtitles ///
title("Replicating Ross, Without Log-Squared GDP" \label{tab:rossrepnolog}) ///
addnotes("Dependent Variable is Female Labor Force Participation. These models exclude log-squared GDP.")

esttab Rep45col12 Rep45col22 Rep45col32 ///
Rep45col52 Rep45col62 Rep45col72 /// 
using ISQFINALAppendixTable05.txt, ///
 replace p label ///
title("Replicating Ross, Without Log-Squared GDP" \label{tab:rossrepnolog}) ///
addnotes("Dependent Variable is Female Labor Force Participation. These models exclude log-squared GDP.")


* * * * * * * * * * * * * * * * * * * * * * * * * 
* Modified Replication (FD, No GDP Sq Log)
* * * * * * * * * * * * * * * * * * * * * * * * * 

local rossmodel2 FDlogGDP_cap2000_sup_1 FDage_1

* p. 137, Table 4.5, column 1
xtregar FDlaborfemale `rossmodel2'
eststo Rep45col13

* p. 137, Table 4.5, column 2
xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1
eststo Rep45col23

* p. 137, Table 4.5, column 3
xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1
eststo Rep45col33

* p. 137, Table 4.5, column 4
* xtreg FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 year1* year2*, fe
* eststo Rep45col42

* p. 137, Table 4.5, column 5
xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if cty != "Saudi Arabia" & cty != "Kuwait"
eststo Rep45col53

* p. 137, Table 4.5, column 6
xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if me_nafr==0
eststo Rep45col63

* p. 137, Table 4.5, column 7
xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if me_nafr==1
eststo Rep45col73

*Column 8: using log of oil income
xtregar FDlaborfemale `rossmodel2' FDlogoil_gas_valuePOP_1
eststo Rep45col83

esttab Rep45col13 Rep45col23 Rep45col33 ///
Rep45col53 Rep45col63 Rep45col73 /// 
using ISQFINALAppendixTable07.tex, ///
 replace p label nomtitles ///
booktabs substitute({table} {sidewaystable}) ///
title("Replicating Ross, First-Difference Only, Without Log-Squared GDP" \label{tab:fdrepnolog}) ///
addnotes("Dependent Variable is Female Labor Force Participation, first-differencing only. These models exclude log-squared GDP.")

esttab Rep45col13 Rep45col23 Rep45col33 ///
Rep45col53 Rep45col63 Rep45col73 /// 
using ISQFINALAppendixTable07.txt, ///
 replace p label ///
title("Replicating Ross, First Difference Only, Without Log-Squared GDP" \label{tab:fdrepnolog}) ///
addnotes("Dependent Variable is Female Labor Force Participation, first-differencing only. These models exclude log-squared GDP.")


* * * * * * * * * * * * * * * * * * * * * * * * * 
* Modified Replication (FD, With GDP Sq Log)
* * * * * * * * * * * * * * * * * * * * * * * * * 

* p. 137, Table 4.5, column 1
xtregar FDlaborfemale `rossmodel'
eststo Rep45col14

* p. 137, Table 4.5, column 2
xtregar FDlaborfemale `rossmodel' FDoil_gas_valuePOPred_1
eststo Rep45col24

* p. 137, Table 4.5, column 3
xtregar FDlaborfemale `rossmodel' FDoil_gas_valuePOPred_1
eststo Rep45col34

* p. 137, Table 4.5, column 4
* xtreg FDlaborfemale `rossmodel' FDoil_gas_valuePOPred_1 year1* year2*, fe
* eststo Rep45col42

* p. 137, Table 4.5, column 5
xtregar FDlaborfemale `rossmodel' FDoil_gas_valuePOPred_1 ///
if cty != "Saudi Arabia" & cty != "Kuwait"
eststo Rep45col54

* p. 137, Table 4.5, column 6
xtregar FDlaborfemale `rossmodel' FDoil_gas_valuePOPred_1 ///
if me_nafr==0
eststo Rep45col64

* p. 137, Table 4.5, column 7
xtregar FDlaborfemale `rossmodel' FDoil_gas_valuePOPred_1 ///
if me_nafr==1
eststo Rep45col74

*Column 8: using log of oil income
xtregar FDlaborfemale `rossmodel' FDlogoil_gas_valuePOP_1
eststo Rep45col84

esttab Rep45col14 Rep45col24 Rep45col34 ///
Rep45col54 Rep45col64 Rep45col74 /// 
using ISQFINALAppendixTable06.tex, ///
 replace p label nomtitles ///
booktabs substitute({table} {sidewaystable}) ///
title("Replicating Ross, First-Difference Only, With Log-Squared GDP" \label{tab:fdrepnolog}) ///
addnotes("Dependent Variable is Female Labor Force Participation, first-differencing only. These models include log-squared GDP.")

esttab Rep45col14 Rep45col24 Rep45col34 ///
Rep45col54 Rep45col64 Rep45col74 /// 
using ISQFINALAppendixTable06.txt, ///
 replace p label ///
title("Replicating Ross, First Difference Only, With Log-Squared GDP" \label{tab:fdrepnolog}) ///
addnotes("Dependent Variable is Female Labor Force Participation, first-differencing only. These models include log-squared GDP.")


* * * * * * * * * * * * * * * * * * * * * * * * * 
* Before, During, After Boom
* * * * * * * * * * * * * * * * * * * * * * * * * 

* First, Ross's models
xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if year <= 1979, fe
eststo rossmodelbefore79

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if year > 1979, fe
eststo rossmodelafter79

* Now our models

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if year <= 1973, fe
eststo rossmodelaltearly

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if year >= 1974 & year <=1986, fe
eststo rossmodelaltmiddle

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if year > 1986, fe
eststo rossmodelaltlate


esttab Rep45col22 rossmodelbefore79 rossmodelafter79 ///
rossmodelaltearly rossmodelaltmiddle rossmodelaltlate /// 
using FERossPeriodRevised.txt, ///
 replace p label ///
 mtitles("Ross Base" " Before 1979" "After 1979" "Before 1973" "1973--86" "After 1986")


esttab Rep45col22 rossmodelbefore79 rossmodelafter79 ///
rossmodelaltearly rossmodelaltmiddle rossmodelaltlate /// 
using FERossPeriodRevised.tex, ///
 replace p label ///
 mtitles("Ross Base" " Before 1979" "After 1979" "Before 1973" "1973--86" "After 1986") ///
booktabs substitute({table} {sidewaystable}) ///
title("Revising the Ross Model By Era" \label{tab:rossera}) ///
addnotes("Dependent Variable is Female Labor Force Participation. Columns 1, 2, and 3 substantively replicate Ross (2012)." ///
"Columns 4, 5, and 6 demonstrate that the effect is limited to periods of high oil prices. All variables are first-differenced." ///
" Regressions are run using fixed-effects linear models with robust errors.")


* * * * * * * * * * * * * * * * * * * * * * * * * 
* Pre-Treatment
* * * * * * * * * * * * * * * * * * * * * * * * * 

* Autocracies defined using Polity

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if autoc60 == 1, fe
eststo modautoc60

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if autoc65 == 1, fe
eststo modautoc65

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if autoc73 == 1, fe
eststo modautoc73

* Democracies defined using Polity

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if democ60 == 1, fe
eststo moddemoc60

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if democ65 == 1, fe
eststo moddemoc65

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if democ73 == 1, fe
eststo moddemococ73



* Autocracies defined using Polity

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if cheibubdichot60 == 0, fe
eststo modcheibubautoc60

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if cheibubdichot65 == 0, fe
eststo modcheibubautoc65

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if cheibubdichot73 == 0, fe
eststo modcheibubautoc73


* democracies defined using Polity

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if cheibubdichot60 == 1, fe
eststo modcheibubdemoc60

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if cheibubdichot65 == 1, fe
eststo modcheibubdemoc65

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if cheibubdichot73 == 1, fe
eststo modcheibubdemoc73

esttab modautoc65 modautoc73 ///
moddemoc65 moddemococ73 /// 
modcheibubautoc65 modcheibubautoc73 ///
modcheibubdemoc65 modcheibubdemoc73 ///
using DemocAutoc.txt, ///
title("Heterogenous Effects in the Ross Model") ///
 replace p label ///
 mtitles("Autoc '65" "Autoc '73" "Democ '65" "Democ '73" "Autoc '65" "Autoc '73" "Democ '65" "Democ '73") ///
 addnotes("Models are stratified by whether the countries were autocratic or democratic in 1965 or 1973." ///
 "Columns 1-4 use Polity measure; columns 5-8 use Cheibub, Gandhi and Vreeland (2010) measures.")


esttab modautoc65 modautoc73 ///
moddemoc65 moddemococ73 /// 
modcheibubautoc65 modcheibubautoc73 ///
modcheibubdemoc65 modcheibubdemoc73 ///
using DemocAutoc.tex, ///
 replace p label ///
 mtitles("Autoc '65" "Autoc '73" "Democ '65" "Democ '73" "Autoc '65" "Autoc '73" "Democ '65" "Democ '73") ///
booktabs substitute({table} {sidewaystable}) ///
title("Heterogenous Effects in the Ross Model" \label{tab:heteffects}) ///
 addnotes("Models are stratified by whether the countries were autocratic or democratic in 1965 or 1973." ///
 "Columns 1-4 use Polity measure; columns 5-8 use Cheibub, Gandhi and Vreeland (2010) measures.")



* * * * * * * * * * * * * * * * * * * * * * * * * 
* Monarchies
* * * * * * * * * * * * * * * * * * * * * * * * * 
* Monarchies defined using Polity

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if evermonarch == 1, fe
eststo modmonarch

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if evermonarch == 0, fe
eststo modmonarchno

* Monarchies defined using Cheibub

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if everroyal == 1, fe
eststo modroyal

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if everroyal == 0, fe
eststo modroyalno


* OECD Members


gen oecd2 = 0
replace oecd2 = 1 if oecd == 1
replace oecd2 = 1 if cty == "Korea, Rep." | cty == "Mexico"

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if oecd == 1, fe
eststo modoecd60

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if oecd == 0, fe
eststo modnotOECD

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if oecd2 == 1, fe
eststo modoecd60alt

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if oecd2 == 0, fe
eststo modnotOECDalt

esttab modoecd60 modoecd60alt modnotOECD modnotOECDalt, lab p

esttab modmonarch modmonarchno ///
modroyal modroyalno /// 
using Royalty.txt, ///
title("Monarchy and the Ross Model") ///
 replace p label ///
 mtitles("Monarchy" "Not Monarchy" "Royalty" "Not Royalty") ///
 addnotes("Columns 1-2 use Polity measure; columns 3--4 use Cheibub et al measures.")


esttab modmonarch modmonarchno ///
modroyal modroyalno /// 
using Royalty.tex, ///
 replace p label ///
 mtitles("Monarchy" "Not Monarchy" "Royalty" "Not Royalty") ///
booktabs ///
title("Monarchy and the Ross Model" \label{tab:royalty}) ///
 addnotes("Columns 1-2 use Polity measure; columns 3--4 use Cheibub et al measures.")


esttab modmonarch modmonarchno ///
modroyal modroyalno modoecd60 modnotOECD /// 
using ThreeAlts.tex, ///
 replace p label ///
 mtitles("Monarchy" "Not Monarchy" "Royalty" "Not Royalty" "OECD" "Not OECD") ///
booktabs ///
title("Monarchy and the Ross Model" \label{tab:royalty}) ///
 addnotes("Columns 1-2 use Polity measure; columns 3--4 use Cheibub et al measures.")


* * * * * * * * * * * * * * * * * * * * * * * * * 
* BritCol
* * * * * * * * * * * * * * * * * * * * * * * * * 
gen britcol = 0
replace britcol = 1 if ht_colonial == 5


xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if britcol == 1, fe
eststo modbritcol

xtregar FDlaborfemale `rossmodel2' FDoil_gas_valuePOPred_1 ///
if britcol == 0, fe
eststo modbritcolno


esttab modroyal modroyalno /// 
modbritcol modbritcolno ///
modoecd60 modnotOECD ///
using ISQFINALAppendixTable01.tex, ///
 replace p label ///
 booktabs substitute({table} {sidewaystable})  ///
 mtitles("Monarchy" "Not Monarchy" "Brit. Colony" "Not Brit. Colony" "OECD" "Not OECD") ///
title("Monarchy, Colonial Heritage, and OECD membership" \label{tab:britroyal}) ///
addnotes("Columns 1 and 2 present results stratified by whether a country has ever been a royal" ///
"dictatorship based on the definitions in Cheibub et al. Columns 3 and 4 are stratified  " ///
"by whether a country has a British colonial heritage, as defined by Hadenius and Teorell." ///
"Columns 5 and 6 stratify by OECD membership, using Ross (2012)'s definitions; including " ///
"South Korea and Mexico do not substantially alter the results." ///
" Data from The Quality of Government Dataset and Ross (2012).")



**************************************************
* Stata Housekeeping
**************************************************

capture

